{{define "content"}}
<div class="row">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
              <h2>Query Keys</h2>
              {{if .error}}
              <div class="alert alert-danger alert-dismissible" role="alert">
                <button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
                <strong>Error!</strong> {{.error.Error}}
              </div>
              {{end}}
              {{if .warning}}
              <div class="alert alert-warning alert-dismissible" role="alert">
                <button type="button" class="close" data-dismiss="alert"><span>&times;</span></button>
                <strong>Warning!</strong> {{.warning.Error}}
              </div>
              {{end}}
                {{if .sources}}
                <form onsubmit="window.location = '{{.base_path}}/{{.selected_source}}/' + search.value; return false;">
                    <div class="input-group input-group-lg">
                        <div class="input-group-btn">
                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">{{.selected_source}}<span class="caret"></span></button>
                            <ul class="dropdown-menu">
                                {{$base_path := .base_path}}
                                {{range $index, $source := .sources}}
                                <li><a href="{{$base_path}}/{{$source}}">{{$source}}</a></li>
                                {{end}}
                            </ul>
                        </div>
                        <input id="search" type="text" class="form-control" required>
                        <div class="input-group-btn">
                            <button type="submit" class="btn btn-default">Search</button>
                        </div>
                    </div>
                </form>
                {{else}}
                <div class="alert alert-warning" role="alert">No sources found! Did you forget to attach them?</div>
                {{end}}
            </div>
        </div>
        {{if .value}}
        <hr/>
        <div class="panel panel-default panel-success">
            <div class="panel-heading">
                <h3 class="panel-title">{{.key}}</h3>
            </div>
            <div class="panel-body">
                <pre>{{.value}}</pre>
            </div>
        </div>
        {{end}}
    </div>
</div>
{{end}}
